﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _052
{
    internal class Program
    {
        public unsafe void swap(int* p,int *q)
        {
            int temp = *p;
            *p = *q;
            *q = temp;
        }
        static unsafe void Main(string[] args)
        {
            Program p = new Program();
            int var1 = 10;
            int var2 = 20;
            int* x = &var1;
            int* y = &var2;
            Console.WriteLine("调用Swap的函数前：var1:{0},var2:{1}",var1,var2);
            p.swap(x, y);
            Console.WriteLine("调用Swap的函数后：var1:{0},var2:{1}",var1,var2);
            Console.ReadKey();
        }
    }
}
